package com.mutual.base;

import javax.servlet.http.HttpServletRequest;

public class WebUtils {
	/**
	 * 获取网站基准路径
	 * @param request
	 * @return
	 */
	public static String getBasePath(HttpServletRequest request) {
		String serverPort = "";
		if (request.getServerPort() != 80) {
			serverPort = ":" + request.getServerPort();
		}
		String serverName = request.getServerName();
		String basePath = request.getScheme() + "://" + serverName + serverPort + request.getContextPath() + "/";
		return basePath;
	}
}
